import { request } from '@/api/service'
export const crudOptions = (vm) => {
  return {
    pageOptions: {
      compact: true
    },
    options: {
      height: '100%',
      tableType: 'vxe-table',
      rowKey: true,
      rowId: 'id'
    },
    selectionRow: {
      align: 'center',
      width: 46
    },
    rowHandle: {
      width: 240,
      dropdown: { // 操作列折叠
        atLeast: 2, // 至少几个以上的按钮才会被折叠,注意show=false的按钮也会计算在内（行编辑按钮默认是隐藏的也会占一个位置）
        text: '更多', // dropdown按钮文字
        type: 'primary',
        icon: 'el-icon-more'
      },
      fixed: 'right',
      view: {
        thin: true,
        text: '',
      },
      edit: {
        thin: true,
        text: '',
      },
      remove: {
        thin: true,
        text: '删除',
        // disabled :true,
        // show: false,
      },
      custom: [{
        show: true,
        text: ' 项目',
        type: 'warning',
        size: 'small',
        icon: 'el-icon-s-flag',
        emit: 'editProject'
      }]

    },
    viewOptions: {
      componentType: 'form'
    },
    formOptions: {
      type: 'drawer',
      size: '70%',
      saveRemind: true,
      defaultSpan: 12 // 默认的表单 span
    },
    indexRow: { // 或者直接传true,不显示title，不居中
      title: '序号',
      align: 'center',
      width: 60
    },
    columns: [
        {
        title: 'ID',
        key: 'id',
        disabled: true,
        form: {
          disabled: true,
          show: true,
        }
      },
      {
        title: '公司名称',
        key: 'name',
        minWidth: 90,
        search: {
          disabled: false
        },
        type: 'input',
        form: {
          rules: [ // 表单校验规则
            {
              required: true,
              message: '公司名称必填项'
            }
          ],
          component: {
            span: 12,
            placeholder: '请输入公司名称'
          },
        }
      },
      {
        title: '法人:',
        key: 'owner',
        disabled: true,
        search: {
          disabled: true
        },
        form: {
          component: {
            placeholder: '请输入法人'
          }
        },
        view: {
          disabled: false
        }
      },
   
      {
        title: '公司网址',
        key: 'url',
        disabled: true,
        search: {
          disabled: true
        },
        minWidth: 100,
        type: 'input',
        form: {
          component: {
            placeholder: '请输入公司网址'
          },
        }
      },

      {
        title: '实缴资本【万】',
        key: 'cap',
        disabled: true,
        search: {
          disabled: true
        },
        minWidth: 100,
        type: 'input',
        form: {
          component: {
            placeholder: '实缴资本【万】'
          },
        }
      },
      {
        title: '市值【亿】',
        key: 'val',
        search: {
          disabled: true
        },
        minWidth: 100,
        sortable:true,
        type: 'input',
        form: {
          component: {
            placeholder: '市值【亿】'
          },
        }
      },
      {
        title: '参保人数',
        disabled: true,
        key: 'empNum',
        search: {
          disabled: true
        },
        minWidth: 100,
        type: 'input',
        form: {
          component: {
            placeholder: '参保人数'
          },
        }
      },

      {
        title: '省份',
        key: 'province',
        disabled: true,
        search: {
          disabled: true
        },
        minWidth: 100,
        type: 'input',
        form: {
          component: {
            placeholder: '省份'
          },
        }
      },
      {
        title: '地市',
        key: 'city',
        sortable:true,
        search: {
          disabled: true
        },
        minWidth: 100,
        type: 'input',
        form: {
          component: {
            placeholder: '地市'
          },
        }
      },
      {
        title: '区县',
        sortable:true,
        key: 'district',
        search: {
          disabled: true
        },
        minWidth: 100,
        type: 'input',
        form: {
          component: {
            placeholder: '区县'
          },
        }
      },
      {
        title: '街道/乡镇',
        disabled: true,
        key: 'street',
        search: {
          disabled: true
        },
        minWidth: 100,
        type: 'input',
        form: {
          component: {
            placeholder: '街道/乡镇'
          },
        }
      },
      {
        title: '详细地址',
        key: 'address',
        disabled: true,
        search: {
          disabled: true
        },
        minWidth: 100,
        type: 'input',
        form: {
          component: {
            placeholder: '详细地址'
          },
        }
      },
     {
        title: '业务分类',
        key: 'busType',
        sortable:true,
        search: {
          disabled: false
        },
        width: 145,
        type: 'select',
        dict: {
          data: vm.dictionary('COMP_BUS_TYPE_CHOICES')
        },
        form: {
          show: false,
          value: 0,
          component: {
            span: 12
          }
        }
      }, 
      {
        title: '行业分类',
        key: 'insType',
        search: {
          disabled: false
        },
        width: 145,
        type: 'select',
        dict: {
          data: vm.dictionary('COMP_INS_TYPE_CHOICES')
        },
        form: {
          show: false,
          value: 0,
          component: {
            span: 12
          }
        }
      },
    
      {
        title: '公司类型',
        key: 'type',
        sortable:true,
        search: {
          disabled: false
        },
        width: 100,
        type: 'select',
        dict: {
          data: vm.dictionary('COMP_TYPE_CHOICES')
        },
        form: {
          value: 0,
          component: {
            span: 12
          }
        }
      },
      {
        title: '优先级',
        sortable:true,
        key: 'rank',
        search: {
          disabled: false
        },
        width: 100,
        type: 'select',
        dict: {
          data: vm.dictionary('COMP_RANK_TYPE_CHOICES')
        },
        form: {
          value: 1,
          component: {
            span: 12
          }
        }
      },
      {
        title: '合作进度',
        key: 'progress',
        search: {
          disabled: false
        },
        width: 145,
        type: 'select',
        dict: {
          data: vm.dictionary('COMP_PRO_TYPE_CHOICES')
        },
        form: {
          show: false,
          value: 0,
          component: {
            span: 12
          }
        }
      },
      {
        title: '合作人员',
        key: 'collaborator',
        search: {
          disabled: false
        },
        width: 100,
        type: 'select',
        dict: {
          data: vm.dictionary('COMP_COL_TYPE_CHOICES')
        },
        form: {
          value: '未知',
          component: {
            span: 12
          }
        }
      },
      {
        title: '跟踪进度',
        key: 'description',
        type: 'editor-quill' ,//字段类型
        show: false,
        form: { component: { name: 'd2p-quill', span: 24 } },
      },
     
    ]
  }
}
